﻿// <copyright file="Model.cs" company="City of Portland, BES-ASM">
// </copyright>
// <summary>Model Class</summary>

namespace BESASM.EMGAATS.BusinessClasses
{
  using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;

  /// <summary>
  /// Model class
  /// </summary>
  public class Model
  {
    private INetwork network;
    private string path;

    private List<int> rootnames = new List<int>();
    private List<int> stopnames = new List<int>();
           
    /// <summary>
    ///  Initializes a new instance of the <see cref="Model" /> class.
    /// </summary>
    public Model()
    {
      this.network = null;
      this.Simulations = new SimulationCollection();
    }

    /// <summary>
    /// Gets or sets the name of the model
    /// by convention this will be file name of file geo-database located at Path
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// Gets or sets the model network
    /// </summary>
    public INetwork Network
    {
      get { return this.network; }
      set { this.network = value; }
    }

    /// <summary>
    /// Gets or sets simulations keyed on SimulationName
    /// </summary>
    public SimulationCollection Simulations { get; set; }

    /// <summary>
    /// Gets the number of simulations in the model
    /// </summary>
    public int SimulationCount 
    {
      get { return this.Simulations.Count; }
    }

    /// <summary>
    /// Gets or sets the location of the path model file
    /// </summary>
    public string RootPath
    {
      get
      {
        return this.path;
      }

      set
      {
        if (Directory.Exists(value))
        {
          this.path = value;
        }
        else
        {
          throw new DirectoryNotFoundException(value);
        }
      }
    }
  }
}